function [n t] = count_spikes(v)

spikes =v(2:end-1,:)>-1 & v(2:end-1,:)>v(1:end-2,:) & v(2:end-1,:)>v(3:end,:);
n=sum(spikes);
t=find(spikes(:));
